package lanou.autohome.recommend;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;

/**
 * Created by dllo on 16/8/15.
 */
public class RecommendAdapter extends FragmentPagerAdapter{

    ArrayList<Fragment> fragments;
    ArrayList<String> arrayList = new ArrayList<>();

    public void setFragments(ArrayList<Fragment> fragments) {
        this.fragments = fragments;
        arrayList.add("最新");
//        arrayList.add("优创");
        arrayList.add("快报");
        arrayList.add("视频");
        arrayList.add("新闻");
        arrayList.add("评测");
        arrayList.add("导购");
        arrayList.add("行情");
        arrayList.add("用车");
        arrayList.add("技术");
        arrayList.add("文化");
        arrayList.add("改装");
        arrayList.add("游记");
        arrayList.add("原创视频");
        arrayList.add("说客");

        notifyDataSetChanged();
    }

    public RecommendAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return arrayList.get(position);
    }
}
